<template>
<transition name="">
    <div id="all">
        <router-link to="/">
            <span class="fa fa-close"></span>
        </router-link>
        <div id="logo">
            <span>猎趣</span>
            <p>手机上的跳蚤市场</p>
        </div>
        <div id="regist">
            <input type="text" placeholder="用户名3~10位任意字符或汉字" v-model="username">
            <input type="password" placeholder="密码大小写字母、数字5~12位" v-model="psw">
            <input type="password" placeholder="确认密码" v-model="confirm">
            <button @touchstart="loginBtn">注册</button>
        </div>
        <router-link to="/second/User/Login">
            <div id="footer">
                <p>已有账号,去登录</p>
                <span class="fa fa-angle-down"></span>
            </div>
        </router-link>
        <div id="other">
            <hr>
            <span>或用以下方式登录</span>
            <hr>
        </div>
        <div id="login">
            <div class="item"> 
                <span class="fa fa-weixin"></span>
                <p>微信登录</p>
            </div>
            <div class="item">
                <span class="fa fa-weibo"></span>
                <p>微博登录</p>
            </div>
            <div class="item">
                <span class="fa fa-qq"></span>
                <p>QQ登录</p>
            </div>
        </div>
    </div>
</transition>
</template>

<script>
export default{
    data:function(){
        return{
            username:"",
            psw:"",
            confirm:""
        }
    },
    methods:{
        loginBtn:function(){
            if(this.username==""||this.psw==""||this.confirm==""){
                layer.msg("请完善用户信息");
                return;
            }
            var params = {
                username:this.username,
                psw:this.psw
            }
            this.$store.dispatch("requestRegist",params)
            .then(res=>{
                layer.msg(res.data.msg);
                this.username = "";
                this.psw = "";
                this.confirm = "";
            })
        }
    }
}
</script>

<style scoped>
    #all{
        background-color: white;
        width: 100vw;
        height: 100vh;
    }
    .fa-close{
        /*position: absolute;*/
        font-size: 25px;
        margin-left: 8px;
        margin-top: 8px;
    }
    #logo{
        /*position: absolute;*/
        margin-left: 50%;
        margin-top: 20px;
        transform: translateX(-50%);
        text-align: center;
    }
    #logo span{
        font-size: 60px;
        color: red;
        font-family: 楷体;
    }
    #logo p{
        margin: 0;
        font-family: 宋体;
        font-weight: 550;
    }
    #regist{
        position: absolute;
        left: 50%;
        top: 180px;
        transform: translateX(-50%);
        width: 80%;
    }
    #regist input{
        width: 100%;
        border-top: none;
        border-left: none;
        border-right: none;
        border-bottom: 1px solid red;
        margin-bottom: 30px;
        font-size: 15px;
    }
    #regist button{
        width: 100%;
        height: 35px;
        background-color: red;
        color: white;
        border: none;
        border-radius: 6px;
    }
    #footer{
        position: absolute;
        left: 50%;
        bottom: 0;
        transform: translateX(-50%); 
        text-align: center;
        font-family: 宋体;
    }
    #footer p{
        margin: 0;
        font-size: 14px;
    }
    #footer span{
        font-size: 25px;
    }
    a{
        color: black
    }
    #other{
       display: flex;
       width: 80%;
       text-align: center;
       position: absolute;
       left: 32px;
       bottom: 140px;
    }
    #other span{
        font-size: 12px;
        font-family: 宋体;
    }
    hr{
        width: 30%;
        display: inline-block;
    }
    #login{
        display: flex;
        justify-content: space-around;
        width: 80%;
        position: absolute;
        left: 30px;
        bottom: 80px;
    }
    .item{
        text-align: center;
    }
    .item span{
        font-size: 30px;
    }
    .item p{
        margin: 0;
        font-size: 12px;
    }
</style>